
# 快慢指针删除数组指定元素

def delEelement(n,num):
    low = 0
    fast = 0
    for i in range(0,len(n)):
        if n[fast]!=num:
            n[low] = n[fast]
            low = low + 1
        fast = fast + 1
    length = len(n)
    for j in range(low,length):
        n.pop()
        length = len(n)
    return n,len(n)

if __name__ == "__main__":
    arr = input()
    n = [int(i) for i in arr.split()]
    num = int(input())
    n,length = delEelement(n,num)
    print(n)
    print(length)